package com.jt.www.enums.issue;

/**
 * 保单和电子发票发送状态
 */
public enum PolicyOrinvoiceSendStatusEnum {
    PISS_01("1", "待处理"),
    PISS_02("2", "处理成功"),
    PISS_03("3", "电子保单处理失败"),
    PISS_05("5", "红冲电子发票失败"),
    PISS_06("6", "请求电子保单失败/电子发票生成但是没有绑定资源"),
    PISS_07("7", "请求电子发票拼接参数失败"),
    PISS_08("8", "红冲成功电子发票不进行后续操作"),
    PISS_10("10", "其他");

    //电子保单标识
    public final static String POLICY_TYPE = "1";

    //电子发票标识
    public final static String INVOICE_TYPE = "3";

    //电子保单或者电子发票发送次数 默认1次
    public final static int SEND_TIMES = 1;

    private String code;
    private String desc;

    PolicyOrinvoiceSendStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PolicyOrinvoiceSendStatusEnum getEnumByCode(String code) {
        for (PolicyOrinvoiceSendStatusEnum statusEnum : PolicyOrinvoiceSendStatusEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum;
            }
        }
        return PISS_10;
    }

    public static String getPolicyType() {
        return POLICY_TYPE;
    }

    public static String getInvoiceType() {
        return INVOICE_TYPE;
    }

    public static int getSendTimes() {
        return SEND_TIMES;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
